package Scrap;

public class demo28_Stack_LLE {

	Node head;

	public static void main(String[] args) {

	demo28_Stack_LLE d=new demo28_Stack_LLE();
	d.push(10);
	d.push(20);
	d.push(45);
//	d.pop();
//	d.pop();
	d.print();
	
	
	}

	// push Linked-List implementation
	void push(int v) {
		if (head == null) {

			head = new Node(v, null);

		} else {

			Node n = new Node(v, null);
			n.next = head;
			head = n;

		}

	}

	int pop() {
		int temp = 0;

		if (head == null) {
			System.out
					.println("the Linked-List is empty there is nothing to pop");

		} else {

			temp = head.v;
			head = head.next;

		}

		return temp;

	}

	void print() {
		if (head == null) {

			System.out
					.println("the Linked-List is empty there is nothing to print");

		} else {

			Node temp = head;
			while (temp != null) {

				System.out.println(temp.v);
				temp = temp.next;

			}

		}

	}

	
}
